#include <fermat/event/event_loop.h>
#include <fermat/event/timer_wheel.h>
#include <fermat/common/format.h>
#include <iostream>
int g_i = 0;
fermat::event::TimerWheelHander gth;
fermat::event::EventLoop *gloop = NULL;
fermat::event::TimerWheel *gwheel = NULL;      
void show()
{
    fermat::print("{} timer\r\n", g_i++);
    if(g_i > 100) {
        gwheel->stop();
        gloop->quit();
    }
}

void loopshow()
{
    std::cout<<"aa"<<std::endl;
}

int main()
{
    fermat::event::EventLoop loop;
    gloop = &loop;
    fermat::event::TimerWheel wheel(gloop, 120);
    gwheel = &wheel;
    gwheel->start();
    gth = gwheel->addTimer(std::bind(&show), 1, true);
    gloop->runEvery(2000000, std::bind(&loopshow));
    gloop->loop();
    return 0;

}
